local t = {}

local Name = {}
for i=1,8 do
	Name[#Name+1] = string.char(math.random(65,90),math.random(65,90),math.random(65,90),math.random(65,90))
end

for i=1,#Name do
	t[#t+1] = Def.ActorFrame {
		LoadActor(THEME:GetPathB("","_frame 3x1"), "HighScoreFrame", (SCREEN_WIDTH-20)-40);
		LoadFont("HighScore")..{
			Text=tostring(i);
			InitCommand=cmd(shadowlength,0;zoom,0.55;x,-SCREEN_CENTER_X+40);
		};
		
		LoadFont("HighScore")..{
			Text=Name[i] or "DESU";
			InitCommand=cmd(shadowlength,0;zoom,0.55;x,-120);
		};
		
		LoadFont("HighScore")..{
			Text=string.format("%08i",i == 1 and 10000000 or 1000000);
			InitCommand=cmd(shadowlength,0;zoom,0.55;x,50;horizalign,left);
		};
	}
end

return Def.ActorFrame {
	Def.ActorScroller {
		NumItemsToDraw=8;
		SecondsPerItem=0.75;
		TransformFunction=function(self, offset, itemIndex, numItems) self:y(offset*48) end;
		InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y+50);
		OnCommand=function(self)
			self:SetCurrentAndDestinationItem(4);
			--self:SetLoop(true);
		end;
		children = t;
	};

	LoadActor(THEME:GetPathG("_frame","1D"), {0, 1/8, 6/8, 1/8, 0}, LoadActor("header") )..{
		InitCommand=cmd(x,SCREEN_CENTER_X;y,35);
		ChildrenCommand=cmd(blend,'BlendMode_Add');
		
		OnCommand=function(self,...)
			self:playcommand("SetSize", {Width = SCREEN_WIDTH} );
			self:playcommandonchildren("Children");
		end;
	};
	
	LoadActor("result")..{
		InitCommand=cmd(x,SCREEN_CENTER_X;y,34);
	};
	
	LoadActor("highscore")..{
		InitCommand=cmd(x,20;y,35;horizalign,left;blend,'BlendMode_Add');
	};
	
	LoadActor("top20")..{
		InitCommand=cmd(x,SCREEN_WIDTH-20;y,34;horizalign,right;blend,'BlendMode_Add');
	};
}